package cn.abcsys.cloud.devops.runtime.controller;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONObject;

import cn.abcsys.cloud.devops.runtime.service.ClusterService;
import cn.abcsys.cloud.devops.runtime.service.HostService;
import cn.abcsys.cloud.devops.runtime.service.ImageService;


/**
 * 环境管理控制器
 * @author mayunhao
 *
 */
@RestController
@RequestMapping("/board")
public class BoardController {
	@Autowired
	private HostService hostService;
	@Autowired
	private ImageService imageService;
	@Autowired
	private ClusterService clusterService;
	@RequestMapping(value = "/all", method = { RequestMethod.GET })
	@ResponseBody
	public JSONObject board(){
		JSONObject hostboard = hostService.hostBoard();
		JSONObject imageboard = imageService.imageBoard();
		JSONObject clusterboard = clusterService.clusterBoard();
		JSONObject jsonObject = new JSONObject();
		jsonObject.put("hostboard", hostboard);
		jsonObject.put("imageboard", imageboard);
		jsonObject.put("clusterboard", clusterboard);
		return jsonObject;
	}
}
